VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "msdatgrd.ocx"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmBasicAPSetup 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   9540
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   11940
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   9540
   ScaleWidth      =   11940
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   27
      Top             =   9255
      Width           =   11940
      _ExtentX        =   21061
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   7834
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin ITGControls.ITGTab SSTab1 
      Height          =   5325
      Left            =   30
      TabIndex        =   28
      Top             =   30
      Width           =   11805
      _ExtentX        =   20823
      _ExtentY        =   9393
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      InActiveTabForeColor=   0
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483630
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   4410
         Left            =   -75000
         TabIndex        =   26
         Top             =   315
         Width           =   11805
         _ExtentX        =   20823
         _ExtentY        =   7779
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   3
         BeginProperty Column00 
            DataField       =   "cTranNo"
            Caption         =   "Transaction"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cDesc"
            Caption         =   "Description"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cRefNo"
            Caption         =   "Reference"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            AllowRowSizing  =   0   'False
            BeginProperty Column00 
               ColumnAllowSizing=   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1695.118
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   4545.071
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
               ColumnWidth     =   1934.929
            EndProperty
         EndProperty
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   5130
         Left            =   0
         Top             =   315
         Width           =   11805
         _ExtentX        =   20823
         _ExtentY        =   9049
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Payable Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.CommandButton cmdPickWork 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   3435
            Picture         =   "frmBasicAPSetup.frx":0000
            Style           =   1  'Graphical
            TabIndex        =   8
            Top             =   1770
            Width           =   315
         End
         Begin VB.CommandButton cmdPickProject 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   3435
            Picture         =   "frmBasicAPSetup.frx":014A
            Style           =   1  'Graphical
            TabIndex        =   6
            Top             =   1470
            Width           =   315
         End
         Begin VB.ComboBox cboTaxType 
            Appearance      =   0  'Flat
            BackColor       =   &H00FFFFFF&
            Height          =   315
            ItemData        =   "frmBasicAPSetup.frx":0294
            Left            =   1905
            List            =   "frmBasicAPSetup.frx":02A1
            TabIndex        =   16
            Top             =   4245
            Width           =   1110
         End
         Begin VB.CheckBox chkTaxable 
            BackColor       =   &H00F7D9C2&
            Caption         =   "Vatable ?"
            Height          =   270
            Left            =   630
            TabIndex        =   14
            Top             =   3945
            Width           =   1080
         End
         Begin VB.CheckBox chkEWT 
            BackColor       =   &H00F7D9C2&
            Caption         =   "w/ EWT"
            Height          =   270
            Left            =   7620
            TabIndex        =   17
            Top             =   4275
            Visible         =   0   'False
            Width           =   960
         End
         Begin VB.CommandButton cmdPickCode 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   3435
            Picture         =   "frmBasicAPSetup.frx":02BD
            Style           =   1  'Graphical
            TabIndex        =   4
            Top             =   1170
            Width           =   315
         End
         Begin VB.Frame Frame2 
            BackColor       =   &H00F7D9C2&
            Caption         =   "Covered Date"
            Height          =   1125
            Left            =   690
            TabIndex        =   36
            Top             =   2490
            Width           =   3720
            Begin ITGControls.ITGDateBox dtbCovFrom 
               Height          =   285
               Left            =   1965
               TabIndex        =   10
               Top             =   285
               Width           =   1455
               _ExtentX        =   2566
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   ""
               SendKeysTab     =   -1  'True
            End
            Begin ITGControls.ITGDateBox dtbCovTo 
               Height          =   285
               Left            =   1965
               TabIndex        =   11
               Top             =   585
               Width           =   1455
               _ExtentX        =   2566
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   ""
               SendKeysTab     =   -1  'True
            End
            Begin VB.Label Label10 
               AutoSize        =   -1  'True
               BackStyle       =   0  'Transparent
               Caption         =   "Date From"
               Height          =   195
               Left            =   225
               TabIndex        =   38
               Top             =   300
               Width           =   750
            End
            Begin VB.Label Label11 
               AutoSize        =   -1  'True
               BackStyle       =   0  'Transparent
               Caption         =   "Date To"
               Height          =   195
               Left            =   240
               TabIndex        =   37
               Top             =   615
               Width           =   570
            End
         End
         Begin VB.Frame Frame4 
            BackColor       =   &H00F7D9C2&
            Height          =   1125
            Left            =   4635
            TabIndex        =   32
            Top             =   2490
            Width           =   3720
            Begin VB.ComboBox cboTerms 
               Appearance      =   0  'Flat
               BackColor       =   &H00FFFFFF&
               Height          =   315
               Left            =   1965
               Style           =   2  'Dropdown List
               TabIndex        =   13
               Top             =   585
               Width           =   1455
            End
            Begin ITGControls.ITGDateBox dtbStatement 
               Height          =   285
               Left            =   1965
               TabIndex        =   12
               Top             =   285
               Width           =   1455
               _ExtentX        =   2566
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Text            =   ""
               SendKeysTab     =   -1  'True
            End
            Begin ITGControls.ITGTextBox txtTerms 
               Height          =   285
               Left            =   1995
               TabIndex        =   33
               Tag             =   "cboType"
               Top             =   585
               Visible         =   0   'False
               Width           =   1155
               _ExtentX        =   1931
               _ExtentY        =   503
               BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               Mandatory       =   -1  'True
               Label           =   "Invoice Type"
               BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
                  Name            =   "Tahoma"
                  Size            =   8.25
                  Charset         =   0
                  Weight          =   400
                  Underline       =   0   'False
                  Italic          =   0   'False
                  Strikethrough   =   0   'False
               EndProperty
               LabelWidth      =   0
               TextBoxWidth    =   1095
            End
            Begin VB.Label Label12 
               AutoSize        =   -1  'True
               BackStyle       =   0  'Transparent
               Caption         =   "Statement Date"
               Height          =   240
               Left            =   225
               TabIndex        =   35
               Top             =   300
               Width           =   1140
            End
            Begin VB.Label Label4 
               AutoSize        =   -1  'True
               BackStyle       =   0  'Transparent
               Caption         =   "Terms"
               Height          =   195
               Left            =   225
               TabIndex        =   34
               Top             =   615
               Width           =   435
            End
         End
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   3645
            Top             =   570
         End
         Begin ITGControls.ITGTextBox txtTranNo 
            Height          =   285
            Left            =   660
            TabIndex        =   0
            Top             =   570
            Width           =   2745
            _ExtentX        =   4630
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Transaction ID"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   1405
            Required        =   -1  'True
         End
         Begin ITGControls.ITGDateBox dtgTranDate 
            Height          =   285
            Left            =   6945
            TabIndex        =   1
            Top             =   570
            Width           =   1515
            _ExtentX        =   2672
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtAmount 
            Height          =   285
            Left            =   6375
            TabIndex        =   25
            Top             =   4590
            Width           =   2895
            _ExtentX        =   4895
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   12648447
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            MaximumValue    =   9999999999.99
            DecimalPlace    =   2
            Label           =   "Amount"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1200
            TextBoxWidth    =   1635
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtTaxType 
            Height          =   285
            Left            =   2040
            TabIndex        =   21
            Tag             =   "cboType"
            Top             =   4215
            Visible         =   0   'False
            Width           =   1110
            _ExtentX        =   1852
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Transaction Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1050
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtName 
            Height          =   285
            Left            =   3750
            TabIndex        =   20
            Top             =   1170
            Width           =   4710
            _ExtentX        =   8202
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   4650
         End
         Begin ITGControls.ITGTextBox txtCode 
            Height          =   285
            Left            =   660
            TabIndex        =   3
            Top             =   1170
            Width           =   2745
            _ExtentX        =   4630
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Supplier"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   1405
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtRefNo 
            Height          =   285
            Left            =   660
            TabIndex        =   2
            Top             =   870
            Width           =   2745
            _ExtentX        =   4630
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Reference No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   1405
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtDesc 
            Height          =   285
            Left            =   660
            TabIndex        =   9
            Top             =   2070
            Width           =   7800
            _ExtentX        =   13547
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "Description"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   6460
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtTaxCode 
            Height          =   285
            Left            =   1920
            TabIndex        =   15
            Tag             =   "cboType"
            Top             =   3900
            Width           =   1110
            _ExtentX        =   1852
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Mandatory       =   -1  'True
            Label           =   "Transaction Type"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   1050
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtEWTRate 
            Height          =   285
            Left            =   660
            TabIndex        =   18
            Tag             =   "cboType"
            Top             =   4590
            Width           =   2370
            _ExtentX        =   3969
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "EWT Rate"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1210
            TextBoxWidth    =   1100
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtTaxableBase 
            Height          =   285
            Left            =   3615
            TabIndex        =   22
            TabStop         =   0   'False
            Top             =   3960
            Width           =   2625
            _ExtentX        =   4419
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "Taxable Base"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1000
            TextBoxWidth    =   1565
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtEWT 
            Height          =   285
            Left            =   3615
            TabIndex        =   24
            TabStop         =   0   'False
            Top             =   4590
            Visible         =   0   'False
            Width           =   2625
            _ExtentX        =   4419
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "EWT"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1000
            TextBoxWidth    =   1565
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtEWTBase 
            Height          =   285
            Left            =   3615
            TabIndex        =   23
            TabStop         =   0   'False
            Top             =   4275
            Width           =   2625
            _ExtentX        =   4419
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            DecimalPlace    =   2
            Label           =   "EWT Base"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1000
            TextBoxWidth    =   1565
            Enabled         =   0   'False
            LinkForeColor   =   0
         End
         Begin ITGControls.ITGTextBox txtTaxRate 
            Height          =   285
            Left            =   1125
            TabIndex        =   29
            Top             =   4215
            Visible         =   0   'False
            Width           =   1620
            _ExtentX        =   2646
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   "0"
            DataType        =   1
            MaximumValue    =   9999999999.99
            DecimalPlace    =   2
            Label           =   "Tax Rate"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   700
            TextBoxWidth    =   860
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtProjectName 
            Height          =   285
            Left            =   3750
            TabIndex        =   45
            Top             =   1470
            Width           =   4710
            _ExtentX        =   8202
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   4650
         End
         Begin ITGControls.ITGTextBox txtProject 
            Height          =   285
            Left            =   660
            TabIndex        =   5
            Top             =   1470
            Width           =   2745
            _ExtentX        =   4630
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Project"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   1405
            Required        =   -1  'True
         End
         Begin ITGControls.ITGTextBox txtWorkDesc 
            Height          =   285
            Left            =   3750
            TabIndex        =   46
            Top             =   1770
            Width           =   4710
            _ExtentX        =   8202
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   4650
         End
         Begin ITGControls.ITGTextBox txtWork 
            Height          =   285
            Left            =   660
            TabIndex        =   7
            Top             =   1770
            Width           =   2745
            _ExtentX        =   4630
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Work"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1280
            TextBoxWidth    =   1405
            Required        =   -1  'True
         End
         Begin VB.Label Label6 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Tax Code"
            Height          =   195
            Left            =   660
            TabIndex        =   39
            Top             =   4320
            Width           =   690
         End
         Begin VB.Label Label17 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Tax Type"
            Height          =   195
            Left            =   660
            TabIndex        =   31
            Top             =   3600
            Width           =   675
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Transaction Date"
            Height          =   195
            Left            =   5610
            TabIndex        =   30
            Top             =   615
            Width           =   1230
         End
      End
   End
   Begin ITGControls.ComunionFrames ComunionFrames2 
      Height          =   3450
      Left            =   30
      Top             =   5340
      Width           =   11805
      _ExtentX        =   20823
      _ExtentY        =   6085
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Details"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin VB.ComboBox cboAsk 
         BackColor       =   &H00FFFFFF&
         Height          =   315
         ItemData        =   "frmBasicAPSetup.frx":0407
         Left            =   495
         List            =   "frmBasicAPSetup.frx":0414
         Style           =   2  'Dropdown List
         TabIndex        =   41
         Top             =   1890
         Visible         =   0   'False
         Width           =   1095
      End
      Begin VB.ComboBox cboType 
         Height          =   315
         ItemData        =   "frmBasicAPSetup.frx":0423
         Left            =   300
         List            =   "frmBasicAPSetup.frx":0425
         Style           =   2  'Dropdown List
         TabIndex        =   40
         Top             =   1395
         Visible         =   0   'False
         Width           =   1005
      End
      Begin MSDataGridLib.DataGrid dtgAccount 
         Height          =   2580
         Left            =   0
         TabIndex        =   19
         Top             =   420
         Width           =   11805
         _ExtentX        =   20823
         _ExtentY        =   4551
         _Version        =   393216
         AllowUpdate     =   -1  'True
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         WrapCellPointer =   -1  'True
         FormatLocked    =   -1  'True
         AllowDelete     =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   9
         BeginProperty Column00 
            DataField       =   "cType"
            Caption         =   "Type"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cAcctNo"
            Caption         =   "Account No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "0%"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "cTitle"
            Caption         =   "Title"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "nDebit"
            Caption         =   "Debit"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "nCredit"
            Caption         =   "Credit"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "cTaxable"
            Caption         =   "Taxable"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column06 
            DataField       =   "cEWT"
            Caption         =   "EWT"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column07 
            DataField       =   "cRemark"
            Caption         =   "Remark"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column08 
            DataField       =   "cPCcode"
            Caption         =   "Profit Center"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               Button          =   -1  'True
               Locked          =   -1  'True
               Object.Visible         =   -1  'True
               ColumnWidth     =   945.071
            EndProperty
            BeginProperty Column01 
               Button          =   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1049.953
            EndProperty
            BeginProperty Column02 
               ColumnWidth     =   2505.26
            EndProperty
            BeginProperty Column03 
               Alignment       =   1
               ColumnWidth     =   1305.071
            EndProperty
            BeginProperty Column04 
               Alignment       =   1
               ColumnWidth     =   1305.071
            EndProperty
            BeginProperty Column05 
               Button          =   -1  'True
               ColumnWidth     =   720
            EndProperty
            BeginProperty Column06 
               Button          =   -1  'True
               ColumnWidth     =   720
            EndProperty
            BeginProperty Column07 
               Object.Visible         =   -1  'True
            EndProperty
            BeginProperty Column08 
               Button          =   -1  'True
               Locked          =   -1  'True
            EndProperty
         EndProperty
      End
      Begin ITGControls.ITGTextBox txtDebit 
         Height          =   285
         Left            =   3375
         TabIndex        =   42
         Top             =   3045
         Width           =   2685
         _ExtentX        =   4524
         _ExtentY        =   503
         BackColor       =   14737632
         LabelBackColor  =   16243138
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Text            =   "0"
         DataType        =   1
         DecimalPlace    =   2
         Label           =   "Total"
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   1250
         TextBoxWidth    =   1375
         Enabled         =   0   'False
         LinkForeColor   =   0
      End
      Begin ITGControls.ITGTextBox txtCredit 
         Height          =   285
         Left            =   6090
         TabIndex        =   43
         Top             =   3045
         Width           =   1380
         _ExtentX        =   2328
         _ExtentY        =   503
         BackColor       =   14737632
         LabelBackColor  =   16514555
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Text            =   "0"
         DataType        =   1
         Mandatory       =   -1  'True
         DecimalPlace    =   2
         Label           =   ""
         BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         LabelWidth      =   0
         TextBoxWidth    =   1320
         Enabled         =   0   'False
         LinkForeColor   =   0
      End
   End
   Begin VB.Label lblStatus 
      BackColor       =   &H00F7D9C2&
      Caption         =   "Status"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   24
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C0C0C0&
      Height          =   630
      Left            =   120
      TabIndex        =   44
      Top             =   8520
      Width           =   3495
   End
End
Attribute VB_Name = "frmBasicAPSetup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private oPrint As New clsPrinting

Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsDetail As ADODB.Recordset

Private AutoNum As New clsAutoNumber '---Added
Public MenuName As String '---Added

Private connHeader As ADODB.Connection
Private connDetail As ADODB.Connection

Public Enum eBasicPayMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eBasicPayMode

Public dtgName As String
Public sBit As String
Private vBM As Variant

Private lSystemGenerated As Boolean
Public strNo As String

Private nDebit, nCredit, nPayable, nTaxBase, nEWTBase, nEWT As Double

Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean
Private lSysTransDate As Boolean 'add by denz:2/17/2011 for transdate


Private Sub cboAsk_Click()
    If dtgAccount.Col = 5 Then
            'rsDetail!lTaxable = IIf(Trim$(cboAsk) = "YES", "TRUE", "FALSE")
            rsDetail!cTaxable = Trim(cboAsk)
            TotalAmount
    ElseIf dtgAccount.Col = 6 Then
            'rsDetail!lEWT = IIf(Trim$(cboAsk) = "YES", "TRUE", "FALSE")
            rsDetail!cEWT = Trim(cboAsk)
            TotalAmount
    End If
End Sub


Private Sub cboAsk_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If dtgAccount.Col = 5 Then
                'rsDetail!lTaxable = IIf(Trim$(cboAsk) = "YES", "TRUE", "FALSE")
                rsDetail!cTaxable = Trim(cboAsk)
                TotalAmount
        ElseIf dtgAccount.Col = 6 Then
                'rsDetail!lEWT = IIf(Trim$(cboAsk) = "YES", "TRUE", "FALSE")
                rsDetail!cEWT = Trim(cboAsk)
                TotalAmount
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboAsk.Visible = False
    End If
End Sub

Private Sub cboAsk_LostFocus()
    cboAsk.Visible = False
End Sub

Private Sub cboTaxCode_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cboTaxType_Click()
    txtTaxCode = Trim(cboTaxType)
    txtEWTRate = CDbl(GetValueFrTable("cValue", "PARAMETER_USER", "cParamName = '" & cboTaxType & "' and cType='ATCCode'"))
End Sub

Private Sub cboTaxType_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub

Private Sub cboTerms_Click()
    txtTerms = Trim(cboTerms)
End Sub

Private Sub cboTerms_KeyPress(KeyAscii As Integer)
    SendKeysTab KeyAscii
End Sub

Private Sub cboType_Click()
    If dtgAccount.Col = 0 Then
        rsDetail!cType = Trim(cboType)
    End If
End Sub
    
Private Sub cboType_DropDown()
    cboType.Clear
    cboType.AddItem "Payables"
    cboType.AddItem "Others"
End Sub

Private Sub cboType_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        If dtgAccount.Col = 0 Then
            cboType_LostFocus
            dtgAccount.Col = 1
            dtgAccount.SetFocus
        End If
    ElseIf KeyCode = vbKeyEscape Then
        cboType.Visible = False
    End If
End Sub

Private Sub cboType_LostFocus()
    cboType.Visible = False
    If Mode = AddNewEdit Then rsDetail!cType = Trim(cboType)
End Sub



Private Sub chkTaxable_Click()
If chkTaxable.Value = Checked Then
    txtTaxType.Text = "VAT"
Else
    txtTaxType.Text = "NON-VAT"
End If
End Sub

Private Sub cmdPickCode_Click()
    If lPickListActive Then Exit Sub
    frmITGPicker.zType = Qsupplierall
    'Condition
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
    frmITGPicker.Show vbModal
    txtCode = frmITGPicker.zCode
    txtName = frmITGPicker.zName
    If Trim(txtName) <> "" Then
        SendKeys "{Tab}"
    End If
End Sub


Private Sub dtgAccount_Scroll(Cancel As Integer)
cboType.Visible = False
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub


Private Sub txtCode_Change()
    txtName = ""
    txtName = GetValueFrTable("cName", "CLIENT_SUPPLIER_NT", "cCode = '" & Trim(txtCode) & "'")
    If txtName <> "" Then
         txtName = GetValueFrTable("cName", "CLIENT_SUPPLIER_NT", "cCode = '" & Trim(txtCode) & "'")
    Else:  txtName = GetValueFrTable("cName", "CLIENT_SUPPLIER", "cCode = '" & Trim(txtCode) & "'")
        txtTaxCode = GetValueFrTable("cEWTType", "CLIENT_SUPPLIER", "cCode = '" & Trim(txtCode) & "'")
    End If
End Sub

Private Sub txtCode_LostFocus()
If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtName) = "" And Trim(txtCode) <> "" Then cmdPickCode_Click
End Sub

Private Sub txtTaxCode_Change()
    If Trim(txtTaxCode) <> "" Or txtTaxCode <> vbNullString Then
        cboTaxType = Trim(txtTaxCode)
    Else
        cboTaxType.Text = ""
        cboTaxType.ListIndex = -1
    End If
    txtEWTRate.Text = GetValueFrTable("cValue", "parameter_user", "cParamName = '" & Trim(txtTaxCode) & "'")
End Sub

'Private Sub txtTaxCode_Change()
'    If Trim(txtTaxCode) <> "" Or txtTaxCode <> vbNullString Then
'        cboTaxCode = Trim$(txtTaxCode)
'    Else: cboTaxCode.ListIndex = -1
'    End If
'End Sub

Private Sub txtTaxRate_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then TBNewLine
End Sub

Private Sub txtTaxType_Change()
If txtTaxType = "VAT" Then
    chkTaxable.Value = Checked
Else: chkTaxable.Value = Unchecked
End If
End Sub

Private Sub txtTerms_Change()
    If Trim(txtTerms) <> "" Or txtTerms <> vbNullString Then
        cboTerms = Trim(txtTerms)
    Else
        cboTerms.ListIndex = -1
    End If
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

Private Sub Form_Load()

    Set FrmName = Me
    FormSetup

    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'BAP05'")

    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset

    Call LoadComboValues(cboTerms, "cParamname", "PARAMETER_USER", "WHERE cType = 'TERMS'")
    Call LoadComboValues(cboTaxType, "cParamName", "PARAMETER_USER", "WHERE cType = 'ATCCode' AND cCompanyID = '" & Trim(COID) & "'", "nOrder")
    'Call LoadComboValues(cboTaxType, "cParamName", "PARAMETER_USER", "WHERE cType = 'TAXTYPE' AND cCompanyID = '" & Trim(COID) & "'", "nOrder")
    Set FrmName = Me
    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    Mode = Find
    txtTranNo.Locked = False
    
End Sub

Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set connHeader = Nothing
    Set connDetail = Nothing
    Set frmBasicAPSetup = Nothing
    lCloseWindow = True
    
    'oForm(Me.Tag).Mode = 1
    'oForm(Me.Tag).Tag = Me.Tag
End Sub

Public Sub TBAccountAffected()
    RepName = "PAY"
    frmAccountAffected.mModuleType = KPAY
    frmAccountAffected.mRefPK = txtTranNo.Text
    frmAccountAffected.Show vbModal
End Sub

Public Sub TBNew()

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtTranNo.BackColor = &HE0FFFF
    Mode = AddNewEdit

    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenNewConnection connDetail
        OpenRecordsetWithCN rsDetail, "*", "PAYABLES_ACCOUNT", connDetail, "WHERE 1 = 0"
        OpenRecordsetWithCN rsHeader, "*", "PAYABLES", connHeader, "WHERE 1 = 0"
        SetDataField
        SetDataSource
    Else
        vBM = rsHeader.Bookmark
    End If

    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!cEvery = "Monthly"
    rsHeader!dDate = Date
    
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    SSTab1.ActiveTab = 0
    txtTranNo.SetFocus
    txtTranNo.Locked = True
    
    MenuName = "AUTO_NUMBER_PS"
    lSystemGenerated = GetValueFrTable("lAutoNo", "system_autonumber", "cCode = '" & MenuName & "' ")
    If lSystemGenerated Then rsHeader!cTranNo = AutoNum.Generate_CtrlNo2(MenuName, Format(Now, "mm/dd/yyyy"))
    
    strNo = rsHeader!cTranNo
End Sub

Public Sub TBUndoAll()
On Error GoTo ErrorHandler
    Mode = Normal
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    rsHeader.CancelBatch adAffectAll
    rsDetail.CancelBatch adAffectAll
    UnbindControls
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    Set FrmName = Me
    FormLocking True
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True, True, True, True
    Else
        RSZero
        Mode = Find
    End If
    sbRS.Panels(2) = ""
    SetDataSource
    SetDataField
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then
        TBUndoAll
    End If
End Sub

Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler
    GetChild
    If rsHeader.Status = adRecNew Then
        rsDetail.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsDetail.CancelBatch adAffectAll
    End If
    If rsHeader.RecordCount = 0 Then RSZero
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then
        TBUndoCurrent
    End If
End Sub

Public Sub TBSave()
Dim OKUpdate As Boolean
Dim lNew As Boolean
On Error GoTo ErrHandler

    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True

    If Not MandatoryOK Then Exit Sub
    
    If rsHeader.Status = adRecNew Then
        lNew = True
    End If
    
        'System generated number
    If rsHeader.Status = adRecNew Then
        If lSystemGenerated Then
            'If ChkCtrlNo(rsHeader, "AUTO_NUMBER_PS", "PAYABLES", "cTranNo", rsHeader!cTranNo) <> rsHeader!cTranNo Then
            
            If AutoNum.Check_CtrlNo2(rsHeader, "PAYABLES", "cTranNo", rsHeader!cTranNo, MenuName, rsHeader!dDate) <> rsHeader!cTranNo Then
                GetChild
                rsHeader!cTranNo = strNo
                
                If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
                Do Until rsDetail.EOF
                    rsDetail!cTranNo = strNo
                    rsDetail.MoveNext
                Loop
                
                GetChild
            End If
        End If
    End If
    

    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    connDetail.BeginTrans
    rsHeader.UpdateBatch adAffectAll
    rsDetail.UpdateBatch adAffectAll

    cn.CommitTrans
    connHeader.CommitTrans
    connDetail.CommitTrans
    OKUpdate = True

    Set FrmName = Me
    FormLocking True
    'BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, , True, True, True, True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , lACPost, lACCancel, , , True, True, lACPrint, True
    Mode = Normal

  
    
    MsgBox "Record/s successfully saved.", vbInformation, msgTtl

    UpdateLogFile "Payables", Trim(txtTranNo), IIf(lBoolean, "Inserted", "Updated")
    UpdateGLA "Update", "PAY", Trim(txtTranNo)
    
    If lNew = True Then
        If lSystemGenerated And strNo = rsHeader!cTranNo Then
                UpdateControlNo strNo, rsHeader!cTranNo, "AUTO_NUMBER_PS"
                AutoNum.Update_CtrlNo2 strNo, MenuName, Format(Now, "mm/dd/yyyy")
                
            GetChild
            rsHeader!cTranNo = strNo
            
            If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
            Do Until rsDetail.EOF
                rsDetail!cTranNo = strNo
                rsDetail.MoveNext
            Loop
            GetChild
        End If
    End If
    
    If lBoolean = False Then ' Edit
            cn.Execute ("UPDATE PAYABLES SET dUpdated = GETDATE () WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    Else ' Insert
            cn.Execute ("UPDATE PAYABLES SET dUpdated = GETDATE () WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    End If
    sbRS.Panels(2) = ""

ErrHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, msgTtl
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsDetail.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True, True, True, True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, msgTtl
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name
    End If
End Sub

Public Sub TBEdit()
    If rsHeader!lCancelled Then
        MsgBox "Transaction was already cancelled. Edit is not allowed.", vbExclamation, msgTtl
        Exit Sub
    End If
    If rsHeader!lApproved = True Then
        MsgBox "Transaction was already approved. Edit is not allowed.", vbExclamation, "ComUnion"
        Exit Sub
    End If
    
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    txtTranNo.Locked = True
    SSTab1.ActiveTab = 0
    txtRefNo.SetFocus
    vBM = rsHeader.Bookmark
    
    MenuName = "AUTO_NUMBER_PS"
    lSysTransDate = GetValueFrTable("lTransDate", "system_autonumber", "cCode = '" & MenuName & "' ") 'add by denz:2/17/2011
    If lSysTransDate Then
        dtgTranDate.Enabled = True
    Else: dtgTranDate.Enabled = False
    End If
End Sub

Public Sub TBDelete()
On Error GoTo ErrorHandler

    If rsHeader.RecordCount = 0 Then Exit Sub
    
    If rsHeader!lCancelled Then
        MsgBox "Transaction was already cancelled. Delete is not allowed.", vbExclamation, msgTtl
        Exit Sub
    End If

    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub
    UpdateGLA "Delete", "PAY", Trim(txtTranNo)
    
    UpdateLogFile "Payables", Trim(txtTranNo), "Deleted"
    
    GetChild
    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.RecordCount = 0
            rsDetail.Delete adAffectCurrent
            If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
        Loop
    End If
    
    rsHeader.Delete adAffectCurrent
    rsDetail.UpdateBatch adAffectAll
    rsHeader.UpdateBatch adAffectAll
    
    TBPrevRec
    Mode = Normal
    If rsHeader.RecordCount = 0 Then
        RSZero
    End If
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        cn.Execute "DELETE PAYABLES_ACCOUNT WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE PAYABLES WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
        
        ElseIf err.Number = -2147217887 Then
        Resume Next
        
    End If
End Sub

Public Sub TBFind()
    Mode = Normal
    txtTranNo.Locked = True
    frmITGSearch.Show
End Sub

Public Sub TBFindPrimary()
Dim sTemp As String
If Mode = Find Then
    FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
            
    OpenNewConnection connHeader
    OpenNewConnection connDetail
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset
            
    sTemp = Trim$(GetSearchString)
    If sTemp = "ERROR" Then
        MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
        txtTranNo.Locked = False
        txtTranNo.SetFocus
        Exit Sub
    End If
    
    OpenRecordsetWithCN rsHeader, "*", "PAYABLES", connHeader, IIf(sTemp = "", "", " WHERE " & sTemp)
    'OpenRecordsetWithCN rsDetail, "*", "PAYABLES_ACCOUNT", connDetail
                
    OpenRecordsetWithCN rsDetail, "*", "PAYABLES_ACCOUNT", connDetail, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM PAYABLES WHERE " & sTemp & ")")
    
    Set FrmName = Me
    FormLocking True

     If rsHeader.RecordCount = 0 Then
        FormWaitHide
        MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
        Exit Sub
    End If
    SetDataSource
    SetDataField
    txtTranNo.BackColor = &HE0FFFF
    Mode = Normal
    FindTotalAmount
    'BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True, True, , True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , lACPost, lACCancel, , , True, True, lACPrint, True, True
    FormWaitHide
Else
    RSZero
    FormSearch True
    SearchObj True
    Mode = Find
    
End If

End Sub

Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
End Sub

Public Sub TBCloseWindow()
    Unload Me
End Sub

Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader
End Sub

Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader
End Sub

Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader
End Sub

Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader
End Sub
'Add new line to the detail recordset
Public Sub TBNewLine()
    If dtgName = "dtgAccount" Then
        rsDetail.AddNew
        rsDetail!cCompanyID = COID
        rsDetail!cTranNo = Trim(rsHeader!cTranNo)
        rsDetail!nDebit = 0
        rsDetail!nCredit = 0
        rsDetail!cEWT = ""
        rsDetail!cTaxable = ""
        dtgAccount.Col = 0
        GetChild
        If rsDetail.RecordCount <> 0 Then rsDetail.MoveLast
        dtgAccount.SetFocus
    End If

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

End Sub


Public Sub TBDeleteLine()
On Error GoTo ErrorHandler
    If dtgName = dtgAccount.Name Then
        If rsDetail.RecordCount = 0 Then Exit Sub
        vBookMark = dtgAccount.Bookmark
        GetChild
        dtgAccount.Bookmark = vBookMark
        rsDetail.Delete adAffectCurrent
        TotalAmount
    End If
    GetChild

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

Public Sub TBUndoLineAll()
On Error GoTo ErrorHandler
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBPostRecord()
'    MsgBox "Unavailable on " & Me.Name
On Error GoTo TheSource
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Approval is not allowed", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If rsHeader!lApproved = True Then
        MsgBox "Transaction was already approved.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to approve this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub

    cn.Execute ("UPDATE PAYABLES SET dUpdated = GETDATE () WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")

    'Audit trail
    UpdateLogFile "Payable", Trim(txtTranNo), "Approved"

    'Update GL Activity
    UpdateGLA "Update", "PAY", Trim(txtTranNo)
    
    cn.Execute ("UPDATE PAYABLES SET lApproved = 1 WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")
    
    sbRS.Panels(5) = "APPROVED"
    Mode = Normal
    
    rsHeader!lApproved = True
    rsHeader.UpdateBatch adAffectAll

TheSource:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

Public Sub TBCancelRecord()
On Error GoTo ErrorHandler
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled Then
        MsgBox "Transaction was already cancelled.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to cancel this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub
    UpdateGLA "Delete", "PAY", Trim(txtTranNo)
    
    cn.Execute ("UPDATE PAYABLES SET dUpdated = GETDATE () WHERE cTranNo = '" & Trim(txtTranNo) & "' AND cCompanyID = '" & COID & "'")

    UpdateLogFile "Payable", Trim(txtTranNo), "Cancelled"
    
    sbRS.Panels(5) = "CANCELLED"
    Mode = Normal
    
    rsHeader!lCancelled = True
    rsHeader.UpdateBatch adAffectAll

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Public Sub TBPrintRecord()
    RepName = "Basic_ARCMDM_Adjustment_Trans"
    cModule = "Basic_ARCMDM_Adjustment"
    oPrint.PrintReceipt Trim(txtTranNo)
End Sub

Public Sub TBNotify()
    lTasksFlag = "Notify"
    frmTasks.Show 1
End Sub

Public Sub TBReference()
    frmReferenceTrans.Show 1
End Sub

Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgList.DataSource = rsHeader
    Set dtgAccount.DataSource = rsDetail
   
End Sub

Sub SetDataField()
    With rsHeader
        txtTranNo.DataField = !cTranNo
        dtgTranDate.DataField = !dDate
        txtRefNo.DataField = !cRefNo
        txtCode.DataField = !cCode
        txtAmount.DataField = !nAmount
        txtDesc.DataField = !cDesc
        dtbCovFrom.DataField = !dDateCovFrom
        dtbCovTo.DataField = !dDateCovTo
        dtbStatement.DataField = !dDateStatement
        txtTerms.DataField = !cTerms
        txtTaxType.DataField = !cTaxType
        txtTaxRate.DataField = !nTaxRate
        txtEWTRate.DataField = !nEWTRATE
        txtEWTBase.DataField = !nEWTBase
        txtTaxableBase.DataField = !nTaxableBase
        txtEWT.DataField = !nEWT
        txtTaxCode.DataField = !nTaxcode
        txtProject.DataField = !cProjectID
        txtWork.DataField = !cWorkID
    End With
End Sub

Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler

    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount

        If rsHeader.Status <> adRecNew Then
            txtTranNo.Locked = True
        Else
            txtTranNo.Locked = False
        End If

        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else
            sbRS.Panels(2) = ""
        End If
        GetChild
        
        If rsHeader!lCancelled = True Then
            sbRS.Panels(4) = ""
            sbRS.Panels(5) = "CANCELLED"
            lblStatus.Caption = "Cancelled"
            lblStatus.ForeColor = &H8080FF
        ElseIf rsHeader!lApproved = True Then
            sbRS.Panels(4) = ""
            sbRS.Panels(5) = ""
            lblStatus.Caption = "Approved"
            lblStatus.ForeColor = &HC0C0C0
        Else
            sbRS.Panels(4) = ""
            sbRS.Panels(5) = ""
            lblStatus.Caption = ""
            lblStatus.ForeColor = &HC0C0C0
        End If
        
        FindTotalAmount
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtTranNo.Locked = False
        
    End If

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If
End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab1.TabEnabled(1) = False
    Else
        SSTab1.TabEnabled(1) = True
    End If
End Sub

Private Sub txtTranNo_LostFocus()
    If Mode = AddNewEdit Then
        If Trim(txtTranNo) = "" Then
            MsgBox "Empty primary input.", vbInformation, msgTtl
            If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
            txtTranNo.SetFocus
        Else
            If rsHeader.Status <> adRecNew Then Exit Sub
            txtTranNo = Trim(txtTranNo)
            If IDExisting(rsHeader, "cTranNo", "PAYABLES", Trim(rsHeader!cTranNo)) Then
                MsgBox "Transaction ID already exists.", vbInformation, msgTtl
                If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
                txtTranNo.SetFocus
            End If
        End If
    End If
End Sub

Function MandatoryOK() As Boolean

    MandatoryOK = True

    If Trim(txtTranNo) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Bank ID' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtTranNo.SetFocus
        Exit Function
    End If
    
    
    
    If Trim(dtgTranDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        dtgTranDate.SetFocus
        Exit Function
    ElseIf Trim(txtRefNo.Text) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Reference No.' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtRefNo.SetFocus
        Exit Function
    ElseIf Trim(txtCode) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Supplier Code' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtCode.SetFocus
        Exit Function
    ElseIf Trim(txtDesc) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Description' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtDesc.SetFocus
        Exit Function
    End If

    GetChild
    
    If rsDetail.RecordCount < 1 Then
        MandatoryOK = False
        MsgBox "Cannot save transaction without details.", vbInformation, msgTtl
        dtgAccount.SetFocus
        Exit Function
    End If
 
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
    Do Until rsDetail.EOF
        If rsDetail.Status = (adRecNew) Or rsDetail.Status = (adRecModified) Then
            If IsNull(rsDetail!cAcctNo) Or (CDbl(rsDetail!nDebit + rsDetail!nCredit) = 0) Then
                rsDetail.Delete
            ElseIf Trim(rsDetail!cAcctNo) = "" Then
                rsDetail.Delete
            Else
                rsDetail.MoveNext
            End If
        Else
            rsDetail.MoveNext
        End If
    Loop

    
    GetChild
    
    TotalAmount
        
    If txtDebit <> txtCredit Then
        MsgBox "Unbalanced transaction details.", vbCritical, "ComUnion"
        MandatoryOK = False
        Exit Function
    End If
        
        
    If rsDetail.RecordCount < 1 Then
        MsgBox "Cannot save transaction without details.", vbExclamation, msgTtl
        MandatoryOK = False
        Exit Function
    End If

    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.EOF
            rsDetail!nIdentity = rsDetail.AbsolutePosition
            rsDetail.MoveNext
        Loop
    End If
    
End Function

Private Sub GetChild()
    rsDetail.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
End Sub

Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtTranNo.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cTranno LIKE '" & Trim$(txtTranNo.Text) & "%'"
    End If

    If Trim$(dtgTranDate.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dDate = '" & Trim$(dtgTranDate.Text) & "'"
    End If
    
    If Trim$(txtCode.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cCode LIKE '" & Trim$(txtCode.Text) & "%'"
    End If
    
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

Private Sub RSZero()
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    
    Set dtgAccount.DataSource = Nothing
    dtgAccount.Refresh

    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    If rsHeader.State = adStateOpen Then rsHeader.Close
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    txtTranNo.Locked = False
    txtTranNo.SetFocus
    Mode = Find
End Sub

Sub SearchObj(lEnable As Boolean)
    dtgTranDate.Enabled = lEnable
    cmdPickCode.Enabled = lEnable
    cmdPickProject.Enabled = lEnable
    cmdPickWork.Enabled = lEnable
End Sub


Private Sub dtgAccount_AfterColUpdate(ByVal ColIndex As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 1
            If GetValueFrTable("cAcctNo", "ACCOUNT", "cAcctNo = '" & Trim(dtgAccount.Columns(1).Text) & "'") <> "" Then
                dtgAccount.Columns(2).Value = GetValueFrTable("cTitle", "ACCOUNT", "cAcctNo = '" & Trim(dtgAccount.Columns(1).Text) & "'")
            End If
        Case 3                   ' Debit
            If CDbl(dtgAccount.Columns(3).Value) > 0 Then dtgAccount.Columns(4).Value = 0
            TotalAmount
        Case 4                  ' Credit
            If CDbl(dtgAccount.Columns(4).Value) > 0 Then dtgAccount.Columns(3).Value = 0
            TotalAmount
    End Select
End Sub

Private Sub dtgAccount_ButtonClick(ByVal ColIndex As Integer)
    
    If Mode <> AddNewEdit Then Exit Sub
    Select Case ColIndex
        Case 0
            If rsDetail.RecordCount <> 0 Then
                Call MoveCombo(cboType, dtgAccount, dtgAccount.Columns(0))
                ComboLoadValue cboType, Trim(dtgAccount.Columns(0).Text)
            End If
        Case 1   '------------Account---------------------
            If dtgAccount.Columns(0).Text = "Payables" Then
                cTax = txtTaxType.Text
                cEwtCode = txtTaxCode
                cEwtrate = txtEWTRate
                frmBasicAPSetupNew.Show vbModal
                If cString = "Skip" Then
                    If lPickListActive Then Exit Sub
                    If dtgAccount.Columns(0).Text = "" Then Exit Sub
                    PassFilterStringValue Trim(dtgAccount.Columns(1).Text)
                    frmITGPicker.zType = QAccounts
                    frmITGPicker.Show vbModal
                    If Trim(frmITGPicker.zCode) = "" Then Exit Sub
                    dtgAccount.Columns(1).Value = frmITGPicker.zCode & ""
                    dtgAccount.Columns(2).Value = frmITGPicker.zName & ""
                Else
                    AddToGrid
                End If
                dtgAccount.Col = 3
            
            Else
                If lPickListActive Then Exit Sub
                If dtgAccount.Columns(0).Text = "" Then Exit Sub
                PassFilterStringValue Trim(dtgAccount.Columns(1).Text)
                frmITGPicker.zType = QAccounts
                frmITGPicker.Show vbModal
                If Trim(frmITGPicker.zCode) = "" Then Exit Sub
                dtgAccount.Columns(1).Value = frmITGPicker.zCode & ""
                dtgAccount.Columns(2).Value = frmITGPicker.zName & ""
            End If
            
        Case 5
            If rsDetail.RecordCount <> 0 Then
                Call MoveCombo(cboAsk, dtgAccount, dtgAccount.Columns(5))
                ComboLoadValue cboAsk, Trim(dtgAccount.Columns(5).Text)
            End If
            
        Case 6
            If rsDetail.RecordCount <> 0 Then
                Call MoveCombo(cboAsk, dtgAccount, dtgAccount.Columns(6))
                ComboLoadValue cboAsk, Trim(dtgAccount.Columns(6).Text)
            End If
        Case 8
            If lPickListActive Then Exit Sub
            frmITGPicker.zType = QProfitCenter
            'added condition
            frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
            frmITGPicker.Show vbModal
            dtgAccount.Columns(8).Value = frmITGPicker.zCode
        
    End Select
End Sub
'Passing string value to variable 'sFilterString'
Public Sub PassFilterStringValue(str As String)
    If Trim(str) <> "" Then
        sFilterString = Trim(str)
    Else
        sFilterString = ""
    End If
End Sub
Private Sub dtgAccount_Click()
    If Mode = AddNewEdit Then dtgName = dtgAccount.Name
End Sub

Private Sub dtgAccount_Error(ByVal DataError As Integer, Response As Integer)
    If Mode <> AddNewEdit Then
        Response = 0
        Exit Sub
    End If
    If DataError = 7007 Then
        MsgBox "Type mismatch", vbExclamation, msgTtl
    ElseIf DataError = 13 Then
        MsgBox "Type mismatch", vbExclamation, msgTtl
    End If
    Response = 0
End Sub

Private Sub dtgAccount_GotFocus()
    dtgName = dtgAccount.Name
End Sub

Private Sub dtgAccount_KeyDown(KeyCode As Integer, Shift As Integer)
    If Mode <> AddNewEdit Then Exit Sub
    If (Shift = vbCtrlMask And KeyCode = 45) Then
        TBNewLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 46) Then
        TBDeleteLine
    ElseIf (Shift = vbCtrlMask And KeyCode = 83) Then
        TBSave
    End If
End Sub

Private Sub dtgAccount_KeyPress(KeyAscii As Integer)
    
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then Exit Sub

    If KeyAscii = 39 Then KeyAscii = 0
    
    If KeyAscii = 13 Then
        Select Case dtgAccount.Col
            Case 0
                If Not cboType.Visible Then dtgAccount_ButtonClick (0)
            Case 1
                If GetValueFrTable("cAcctNo", "ACCOUNT", "cAcctNo = '" & Trim(dtgAccount.Columns(1).Text) & "'") = "" Then
                    dtgAccount_ButtonClick (1)
                    Exit Sub
                End If
                SendKeys "{Tab}"
                SendKeys "{Tab}"
            Case 5
                TBNewLine
                dtgAccount.Col = 0
            Case Else
                SendKeys "{Tab}"
        End Select
    Else
        KeyAscii = Asc(UCase(Chr(KeyAscii)))
    End If

End Sub

Private Sub dtgAccount_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgAccount.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub


Sub TotalAmount()
Dim DEF_AP As String
Dim DEF_WTAX2 As String
On Error Resume Next

    If Mode <> AddNewEdit Then Exit Sub

    nDebit = 0
    nCredit = 0
    nPayable = 0
    nTaxBase = 0
    nEWTBase = 0
    nEWT = 0
    Set rs = New Recordset
    Set rs = rsDetail.Clone
    rs.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
    
DEF_WTAX2 = GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'DEF_WTAX2'")
DEF_AP = GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'DEF_AP'")
    Do Until rs.EOF
            If rs!cType = "Payables" Or rs!cAcctNo = DEF_AP Or rs!cAcctNo = DEF_WTAX2 Then
                nPayable = nPayable + IIf(IsNull(rs!nCredit), 0, rs!nCredit)
            End If
            If rs!cAcctNo = DEF_WTAX2 Then  ' Account of EWT to compute all the ewt account
                nEWT = nEWT + IIf(IsNull(rs!nCredit), 0, rs!nCredit) '
            End If
            If rs!cEWT = "Yes" Then
                nEWTBase = nEWTBase + IIf(IsNull(rs!nDebit), 0, rs!nDebit)
            End If
            If rs!cTaxable = "Yes" Then
                nTaxBase = nTaxBase + IIf(IsNull(rs!nDebit), 0, rs!nDebit)
            End If
            
            nDebit = nDebit + IIf(IsNull(rs!nDebit), 0, rs!nDebit)
            nCredit = nCredit + IIf(IsNull(rs!nCredit), 0, rs!nCredit)
        rs.MoveNext
    Loop
    Set rs = Nothing
    rsHeader!nAmount = Round(nPayable, 2)
    'rsHeader!nTDebit = nDebit
    'rsHeader!nTCredit = nCredit
    rsHeader!nTaxableBase = nTaxBase
    rsHeader!nEWTBase = nEWTBase
    rsHeader!nEWT = nEWT
    txtCredit.Text = nCredit
    txtDebit.Text = nDebit
    'compute_tax_ewt
End Sub


Sub FindTotalAmount()
Dim DEF_AP As String
Dim DEF_WTAX2 As String
On Error Resume Next

    If Mode = Find Then Exit Sub

    nDebit = 0
    nCredit = 0
    nPayable = 0
    nTaxBase = 0
    nEWTBase = 0
    nEWT = 0
    Set rs = New Recordset
    Set rs = rsDetail.Clone
    rs.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "'"
    
DEF_WTAX2 = GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'DEF_WTAX2'")
DEF_AP = GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'DEF_AP'")
    Do Until rs.EOF
            If rs!cType = "Payables" Or rs!cAcctNo = DEF_AP Or rs!cAcctNo = DEF_WTAX2 Then
                nPayable = nPayable + IIf(IsNull(rs!nCredit), 0, rs!nCredit)
            End If
            If rs!cAcctNo = DEF_WTAX2 Then  ' Account of EWT to compute all the ewt account
                nEWT = nEWT + IIf(IsNull(rs!nCredit), 0, rs!nCredit) '
            End If
            If rs!cEWT = "Yes" Then
                nEWTBase = nEWTBase + IIf(IsNull(rs!nDebit), 0, rs!nDebit)
            End If
            If rs!cTaxable = "Yes" Then
                nTaxBase = nTaxBase + IIf(IsNull(rs!nDebit), 0, rs!nDebit)
            End If
            
            nDebit = nDebit + IIf(IsNull(rs!nDebit), 0, rs!nDebit)
            nCredit = nCredit + IIf(IsNull(rs!nCredit), 0, rs!nCredit)
        rs.MoveNext
    Loop
    Set rs = Nothing
    txtCredit.Text = nCredit
    txtDebit.Text = nDebit
End Sub




Sub compute_tax_ewt() 'gino code
    If Trim(rsHeader!cTaxType) = "VAT" Then
        rsHeader!nTaxableBase = rsHeader!nAmount / getTax
        rsHeader!nEWTBase = rsHeader!nTaxableBase * CDbl(CDbl(rsHeader!nEWTRATE) / 100)
    Else
        rsHeader!nTaxableBase = 0
        rsHeader!nEWTBase = (rsHeader!nAmount / getTax) * CDbl(CDbl(rsHeader!nEWTRATE) / 100)
    End If
End Sub

Private Sub AddToGrid()
    dtgAccount.Columns(1).Value = GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'DEF_AP'")
    rsDetail!cTitle = GetValueFrTable("cTitle", "ACCOUNT", "cAcctNo = '" & Trim(rsDetail!cAcctNo) & "'")
    rsDetail!nDebit = 0
    If vStrContainer3 = "No" Then
        rsDetail!nCredit = Round(vNumContainer1 - (vNumContainer1 * (vNumContainer2 / 100)), 2)
    Else
        rsDetail!nCredit = Round(vNumContainer1 - (((vNumContainer1) / getTax) * (vNumContainer2 / 100)), 2)
    End If
    
    If vNumContainer2 <> 0 Then    ' -- rate
        rsHeader!nTaxcode = vNumContainer3 '-- value of taxtype
        rsHeader!nEWTRATE = vNumContainer2

        rsDetail.AddNew
        rsDetail!cCompanyID = COID
        rsDetail!cTranNo = Trim(rsHeader!cTranNo)
        rsDetail!cType = "Others"
        rsDetail!cAcctNo = GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'DEF_WTAX2'")
        rsDetail!cTitle = GetValueFrTable("cTitle", "ACCOUNT", "cAcctNo = '" & Trim(rsDetail!cAcctNo) & "'")
        rsDetail!nDebit = 0
        rsDetail!cEWT = ""
        rsDetail!cTaxable = ""
        If vStrContainer3 = "No" Then        ' -- taxable ?
                                    '--AMOUNT               --TXTRATE
            rsDetail!nCredit = Round(vNumContainer1 * (vNumContainer2 / 100), 2)
        Else
            rsDetail!nCredit = Round(((vNumContainer1) / getTax) * (vNumContainer2 / 100), 2)
        End If
    End If
    
    rsDetail.AddNew
    rsDetail!cCompanyID = COID
    rsDetail!cTranNo = Trim(rsHeader!cTranNo)
    rsDetail!cType = "Others"
    rsDetail!cAcctNo = vStrContainer1 '-- TXTACCTNO
    rsDetail!cTitle = vStrContainer2 '-- TITLE
    rsDetail!nCredit = 0
    rsDetail!cEWT = IIf(vNumContainer2 <> 0, "Yes", "")
    rsDetail!cTaxable = IIf(vStrContainer3 = "No", "", "Yes")
    If vStrContainer3 = "No" Then
        rsDetail!nDebit = vNumContainer1
        rsHeader!cTaxType = "ZERO-RATED" ' ---- If vat = no
    Else
        rsHeader!cTaxType = "VAT"  ' ---- If vat = yes
        rsDetail!nDebit = Round(((vNumContainer1) / getTax), 2)
        rsDetail.AddNew
        rsDetail!cCompanyID = COID
        rsDetail!cTranNo = Trim(rsHeader!cTranNo)
        rsDetail!cType = "Others"
        rsDetail!cAcctNo = GetValueFrTable("cValue", "SYSTEM_OPTION", "cCode = 'DEF_VAT'")
        rsDetail!cTitle = GetValueFrTable("cTitle", "ACCOUNT", "cAcctNo = '" & Trim(rsDetail!cAcctNo) & "'")
        rsDetail!nDebit = vNumContainer1 - Round(((vNumContainer1) / getTax), 2)
        rsDetail!cEWT = ""
        rsDetail!cTaxable = ""
    End If
    
    rsDetail!nCredit = 0

    TotalAmount
    
    GetChild
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveLast

End Sub

'     OpenRecordsetWithCN rsDetail, "*", "PAYABLES_ACCOUNT", connDetail, "WHERE 1 = 0"
'        OpenRecordsetWithCN rsHeader, "*", "PAYABLES", connHeader, "WHERE 1 = 0"

Public Sub ShowForm(sTranNo As String)
    If Mode = Find Then

        OpenNewConnection connHeader
        OpenNewConnection connDetail

        Set rsHeader = Nothing
        Set rsDetail = Nothing
        Set rsHeader = New ADODB.Recordset
        Set rsDetail = New ADODB.Recordset

        OpenRecordsetWithCN rsDetail, "*", "PAYABLES_ACCOUNT", connDetail, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
        OpenRecordsetWithCN rsHeader, "*", "PAYABLES", connHeader, "WHERE cTranNo = '" & Trim(sTranNo) & "'"

        Set FrmName = Me
        FormLocking True

        If rsHeader.RecordCount = 0 Then
            FormWaitHide
            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
            RSZero
            FormSearch True
            SearchObj True
            Mode = Find
            Exit Sub
        End If
            SetDataSource
            SetDataField
            txtTranNo.BackColor = &HE0FFFF
            Mode = Normal
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True, True

            'BitEnabled Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True, True

    End If
End Sub

Private Sub txtProject_Change()
    txtProjectName = ""
    txtProjectName = GetValueFrTable("cProjectName", "Project_Maintenance", "cProjectNo = '" & Trim(txtProject) & "'")
End Sub


Private Sub txtProject_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtProject) = "" And Trim(txtProject) <> "" Then cmdPickProject_Click
End Sub

Private Sub cmdPickProject_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtProject)
    frmITGPicker.zType = QProject
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
    
    frmITGPicker.Show vbModal
    txtProject = frmITGPicker.zCode
    txtProjectName = frmITGPicker.zName
    If Trim(txtProjectName) <> "" Then SendKeys "{Tab}"
End Sub

Private Sub txtWork_Change()
    txtWorkDesc = ""
    If txtProject.Text = "" Then: txtProject.SetFocus: Exit Sub
    txtWorkDesc = GetValueFrTable("description", "Work_Maintenance_File", "workno = '" & Trim(txtWork) & "' ") 'and cProjectNo =  '" & Trim(txtProject) & "'")
End Sub


Private Sub cmdPickWork_Click()
    If lPickListActive Then Exit Sub
'    sFilterString = Trim(txtWork)
    frmITGPicker.zType = QWork
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "' " 'and cProjectNo = '" & Trim(txtProject) & "'"
    
    frmITGPicker.Show vbModal
    txtWork = frmITGPicker.zCode
    txtWorkDesc = frmITGPicker.zName
    If Trim(txtWorkDesc) <> "" Then SendKeys "{Tab}"
End Sub


Private Sub txtWork_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtWork) = "" And Trim(txtWork) <> "" Then cmdPickWork_Click
End Sub
